﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using JM.JCY.Proxy;
using NCS.IConnect.ApplicationContexts;

namespace JM.JCY.SharePointComponent.PersonalHome.PersonalCulture
{
    public partial class PersonalCultureUserControl : UserControl
    {
        public int _userId
        {
            set { ViewState["_userId"] = value; }
            get { return (int)ViewState["_userId"]; }
        }

        public string _userName
        {
            set { ViewState["_userName"] = value; }
            get { return (string)ViewState["_userName"]; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (ApplicationContext.Current.GetKeyValue("userId") != null)
            {
                _userId = Int32.Parse(ApplicationContext.Current.GetKeyValue("userId").ToString());
            }
            if (ApplicationContext.Current.UserName != null)
            {
                _userName = ApplicationContext.Current.UserName.ToString();
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["StaffId"] != null)
                {
                    this.hfstaffIdCul.Value = Request.QueryString["StaffId"].ToString();
                    if (_userId.ToString() != this.hfstaffIdCul.Value && _userName != "admin")
                        this.lkbEditCulture.Visible = false;
                }
            }
        }
    }
}
